package com.foxchen.offline.task.enums;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

public enum OfflineTaskTypeEnum {

    /**
     * 监控设备实时通讯
     */
    DEVICE_REAL_TIME_COMM("deviceRealTime","{\"en_US\":\"Export Monitor Device Real Time Communication\",\"zh_CN\":\"导出监控设备实时通讯\"}"),

    /**
     * 监控设备历史通讯
     */
    DEVICE_HISTORY_COMM("deviceHistory","{\"en_US\":\"Export Monitor Device History Communication\",\"zh_CN\":\"导出监控设备历史通讯\"}"),

    /**
     * 监控设备通讯切换记录
     */
    DEVICE_SWITCH_RECORD("deviceSwitchRecord","{\"en_US\":\"Export Monitor Device Communication Switch Record\",\"zh_CN\":\"导出监控设备通讯切换记录\"}");

    private final String id;
    private final String name;

    public String getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }
    OfflineTaskTypeEnum(String id,String name){
        this.id=id;
        this.name=name;
    }

    public static String getRealTimeId() {
        return DEVICE_REAL_TIME_COMM.getId();
    }

    public static String getHistoryId() { return DEVICE_HISTORY_COMM.getId(); }

    public static String getSwitchRecordId() {
        return DEVICE_SWITCH_RECORD.getId();
    }

    public static List<String> getTaskTypeAllIdList() {
        List<String> allIdList = new ArrayList();
        OfflineTaskTypeEnum[] values = values();

        for (OfflineTaskTypeEnum value : values) {
            if (StringUtils.isNotBlank(value.getId())) {
                allIdList.add(value.getId());
            }
        }
        return allIdList;
    }

    public static String getNameById(String id)
    {
        String name = "";
        OfflineTaskTypeEnum[] values = OfflineTaskTypeEnum.values();
        for(OfflineTaskTypeEnum value : values)
        {
            if(id.equals(value.getId()))
            {
                name = value.getName();
            }
        }
        return name;
    }
}
